package cn.htsyb.synergy.tester.config;

public class HttpConfig extends InitConfig {
    private static Integer maxTotal;
    private static Integer maxPerRoute;
    private static Integer idleTimeoutMs;
    private static Integer checkIdleTimeMs;
    private static Integer socketTimeoutMs;
    private static String proxyIp;
    private static Integer proxyPort;

    public static int getMaxTotal() {
        maxTotal = maxTotal == null ? synertestConfig.getInt("http.maxTotal") : 0;
        return maxTotal;
    }

    public static int getMaxPerRoute() {
        maxPerRoute = maxPerRoute == null ? synertestConfig.getInt("http.maxPerRoute") : 100;
        return maxPerRoute;
    }

    public static int getIdleTimeoutMs() {
        idleTimeoutMs = idleTimeoutMs == null ? synertestConfig.getInt("http.idleTimeoutMs") : 300000;
        return idleTimeoutMs;
    }

    public static int getCheckIdleTimeMs() {
        checkIdleTimeMs = checkIdleTimeMs == null ? synertestConfig.getInt("http.checkIdleTimeMs") : 300000;
        return checkIdleTimeMs;
    }

    public static int getSocketTimeoutMs() {
        socketTimeoutMs = socketTimeoutMs == null ? synertestConfig.getInt("http.socketTimeoutMs") : 300000;
        return socketTimeoutMs;
    }

    public static String getProxyIp() {
        proxyIp = proxyIp == null ? synertestConfig.getString("http.proxy[@ip]") : null;

        return proxyIp;
    }

    public static Integer getProxyPort() {
        proxyPort = proxyPort == null ? synertestConfig.getInt("http.proxy[@port]") : 80;
        return proxyPort;
    }

}
